import org.deep.cmd.SingleCmd;

public class MockSingleCmd extends SingleCmd<Boolean> {
    public MockSingleCmd(int receiveSize, int reSendTimes, int reSendInterval) {
        super(receiveSize, reSendTimes, reSendInterval);
    }

    @Override
    public byte[] send() {
        byte[] buf = new byte[32];
        buf[0] = (byte) 0xbb;
        buf[1] = 0x01;
        buf[30] = (byte) 0xff;
        buf[31] = calcSumValue(buf);
        return buf;
    }

    @Override
    protected Boolean handle(byte[] buf) {
        return buf[2] == 0x01;
    }

    @Override
    protected boolean check(byte[] buf) {
        return buf[0] == (byte) 0xbb && buf[1] == 0x01 && buf[30] == (byte) 0xff && sumCheck(buf);
    }


}
